package com.net.noah.core.manager.impl;

import com.net.noah.core.dao.SerialNumberMapper;
import com.net.noah.core.domain.SerialNumber;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.net.common.dao.BasicMapper;
import com.net.common.exception.BusinessException;
import com.net.common.manager.AbstractManager;
import com.net.noah.core.manager.SerialNumberManager;

/***
 * 注意,不要配置事务,否则会回滚
 * 后续拆分服务后可以配置上事务
 */
@Component
public class SerialNumberManagerImpl extends AbstractManager<SerialNumber> implements SerialNumberManager {

    @Autowired
    private SerialNumberMapper mapper;

    @Override
    protected BasicMapper<Long, SerialNumber> getMapper() {
        return mapper;
    }

    @Deprecated
    @Override
    public SerialNumber getById(Long key) {
        throw new BusinessException("Not supported, user getByIdWithLock instead");
    }

    @Override
    public SerialNumber getByNameWithLock(String name) {
        return mapper.getByNameWithLock(name);
    }
}
